﻿#region Imports

using System.Collections.Generic;
using d3PrtDgn.Core.BaseData;
using d3PrtDgn.Data.Domain.Entity;

#endregion

namespace d3PrtDgn.Data.IDAO
{
	/// <summary>
	/// User data access object interface
	/// </summary>
    public interface IUserDao : IBaseDao
	{
		/// <summary>
		/// Loads user by ID
		/// </summary>
		/// <param name="userId">Users ID</param>
		/// <returns>Loaded user</returns>
		User FindById(int userId);

		/// <summary>
		/// Loads all users
		/// </summary>
		/// <returns>Loaded users</returns>
		IList<User> FindAll();

		/// <summary>
		/// Saves user
		/// </summary>
		/// <param name="user">User to save</param>
		/// <returns>Saved user</returns>
		User Save(User user);

		/// <summary>
		/// Saves or updates (if already exists) user
		/// </summary>
		/// <param name="user">User to save or update</param>
		/// <returns>Saved or updated user</returns>
		User SaveOrUpdate(User user);

		/// <summary>
		/// Deletes user
		/// </summary>
		/// <param name="user">User to delete</param>
		void Delete(User user);

		/// <summary>
		/// Checks if user with specified username already exists
		/// </summary>
		/// <param name="username">Username to check</param>
		/// <returns>Flag if user with specified username exists</returns>
		bool Exists(string username);

		/// <summary>
		/// Authenticates user - checks username and password
		/// </summary>
		/// <param name="user">User to authenticate</param>
		/// <returns>Authenticated user or null if not valid</returns>
		User Authenticate(User user);
	}
}
